#ifndef __GlSpotLight_h__
#define __GlSpotLight_h__

#include "GlGraphicComponent.h"
#include "GlMain.h"

namespace GraphicLibrary
{
	class GlExport SpotLight
		: public virtual GraphicComponent
	{
		protected:
			class Factory
			{
				public:
					virtual ~Factory();
					virtual SpotLight* create(const float angle, const float distance) = 0;
			};
		public:
			virtual ~SpotLight();
			inline void setColor(const float r, const float g, const float b, const float a)	{mColor[0] = r; mColor[1] = g; mColor[2] = b; mColor[3] = a;}
			inline const float* getColor() const												{return mColor;}
			static void Init(Factory *f)
			{
				if(msFactory)
					delete msFactory;
				msFactory = f;
			}
			static SpotLight* Create(const float angle, const float distance);
		protected:
			const float	mAngle;
			const float	mDistance;

			inline SpotLight(const float angle, const float distance)
				: mAngle(angle)
				, mDistance(distance)
			{
				mColor[0] = mColor[1] = mColor[2] = mColor[3] = 1.0f;
			}
		private:
			float			mColor[4];
			static Factory*	msFactory;
	};
}

#endif // __GlSpotLight_h__
